package zheezes.protocol;

public abstract class PacketAnalyzer {
	public abstract int[] checkPacket(byte[] buf, int length);

	public abstract Frame parse(byte[] buf, int length);

	public int trimPacket(byte[] buf, int length) {
		int[] rs = checkPacket(buf, length);
		int offset = rs[0];
		int len = rs[1];
		if (offset > 0) {
			System.arraycopy(buf, offset, buf, 0, length - offset);
		}
		return len;
	}
}